<#include "../common/_layout.html"/>
<@head title="管理员信息">
<style type="text/css">
    .cll {
        background-color: #ddd;
    }
</style>
</@head>
<@layout menu='/admin'>
<!-- Content Header (Page header) -->


<!-- Main content -->
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <form action="${ctx}/admin" id="listForm" method="post" role="form">
           
                    <div class="box-body table-responsive no-padding">
                        <button type="button" class="btn btn-default" onclick="location.href='${ctx}/admin/edit'">新增</button>
                        <button type="button" id="deleteButton" disabled="disabled" class="btn btn-default"
                                onclick="deleteAll('${ctx}/admin/delete')">删除
                        </button>
                        <table class="table table-hover">
                            <tr class="info">
                                <th title="ID"><input type="checkbox" id="allCheck"></th>
                                <th title="用户名">用户名</th>
                                <th title="姓名">姓名</th>                            
                                <th title="部门">部门</th>
                                <th title="E-mail">E-mail</th>
                                <th title="phonenumber">手机</th>
                                <th>操作</th>
                                <th>管理分配</th>
                            </tr>
                            <#list page.getList() as item>
                                <tr>
                                    <td><input type="checkbox" name="ids" value="${item.id!}"></td>
                                    <td>${item.username!}</td>
                                    <td>${item.name!}</td>
                                    <td>${item.department!}</td>
                                    <td>${item.email!}</td>
                                    <td>${item.phonenumber!}</td>
                                    <td>
                                        <button type="button" class="btn btn-info"
                                                onclick="location.href='${ctx}/admin/edit?id=${item.id}'">编辑
                                        </button>
                                        <button type="button" class="btn btn-info"
                                                onclick="updatepassword('${ctx}/admin/update?id=${item.id}')" >修改密码
                                        </button>
                                    </td>
                                  
                                    <td>
                                        <button type="button" class="btn btn-info"
                                                onclick="location.href='${ctx}/admin/roleAssignment?id=${item.id}'">角色分配
                                        </button>
                                        <button type="button" class="btn btn-info"
                                                onclick="location.href='${ctx}/admin/townsAdminister?id=${item.id}'">乡镇管理
                                        </button>
                                        <button type="button" class="btn btn-info"
                                                onclick="location.href='${ctx}/admin/wxAdminister?id=${item.id}'">公众号管理
                                        </button>
                                    </td>
                                    
                                </tr>
                            </#list>
                        </table>
                        <#if (page.list?size>0)>
                        <#include "../common/pager.html">
                        </#if>
                    </div>
                </form>
            </div>
        </div>
    </div>
</section>
</@layout>
<@scripts>
<script type="text/javascript" src="${ctx}/adminlte/plugins/bootbox/bootbox.min.js"></script>
<script type="text/javascript" src="${ctx}/js/list.js"></script>
<script type="text/javascript">
	bootbox.setLocale("zh_CN");
	function updatepassword(url){
		bootbox.prompt({title: "请输入新密码", inputType: 'password', callback: function(result){
			if(result!=null&&result!=""){
				$.ajax({
					"type" : "post",
					"url" : url,
					"data" : {
						password : result
					},
					"dataType" : "json",
					"async" : false,
					"success" : function(data) {
						bootbox.alert(data.message);
					}
				});
				
			}else if(result!=null){
				bootbox.alert("密码不能为空！");
			}
		}});		
	};
</script>
</@scripts>